package com.project.webapp.action.front.preSchool;

import java.util.List;

import com.project.dao.bean.Active;
import com.project.service.front.preSchool.ActiveService;
import com.project.webapp.action.BaseAction;

/**
 * 发布活动信息 Action
 * @author Sn
 *
 */
public class ActiveAction extends BaseAction 
{

	/**
	 * 序列化版本号
	 */
	private static final long serialVersionUID = 1L;
	private String operateResult = "";

	private ActiveService activeService;
	private Active active;
	List<Active> activeList;
	
	@Override
	public String execute() throws Exception 
	{
		active = new Active();
		if(activeList!=null && activeList.size()>0)
		{
			activeList.clear();
		}
		return this.query();
	}
	
	public String showAdd() 
	{
		active = new Active();
        operateResult = "";
        return SUCCESS;
    }

    /**
     * 
     * <pre>
     * 查询
     * </pre>
     *
     * @return
     */
    public String query() 
    {

        return SUCCESS;
    }
    
    /**
     * 
     * <pre>
     * 保存
     * </pre>
     *
     * @return
     */
    public String save() 
    {
    	try 
    	{
    		active.setArea(active.getArea_s()+active.getArea_e());
    		active.setA_time_s(active.getA_time_sm()+active.getA_time_sd());
    		active.setA_time_e(active.getA_time_em()+active.getA_time_ed());
    		activeService.save(active);
    		operateResult = "suc";
    	} catch (Exception e) 
    	{
    		e.printStackTrace();
    		operateResult = "fail";
    	}
    	active = new Active();
    	return "suc";
    }

	public String getOperateResult() {
		return operateResult;
	}

	public void setOperateResult(String operateResult) {
		this.operateResult = operateResult;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public ActiveService getActiveService() {
		return activeService;
	}

	public void setActiveService(ActiveService activeService) {
		this.activeService = activeService;
	}

	public Active getActive() {
		return active;
	}

	public void setActive(Active active) {
		this.active = active;
	}

	public List<Active> getActiveList() {
		return activeList;
	}

	public void setActiveList(List<Active> activeList) {
		this.activeList = activeList;
	}
    
}
